package com.feicheng.lanniao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.entity.Brand;
import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.IBrandService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-09-02
 */
@RestController
@RequestMapping("/lanniao-admin/brand")
public class BrandController {
	@Autowired
	private IBrandService iBrandService;
	/**
	 * 查询所有品牌信息
	 * @param size 前端页面展示所需要的品牌个数
	 * @return 所有品牌集合
	 */
	@GetMapping("/list")
	public ResultInfo getAllBrands(Integer size) {
		return iBrandService.getBrandInfo(size);
	}
	/**
	 * 	查询1条车辆品牌信息
	 * @param brandId 品牌ID
	 * @return 品牌对象
	 */
	@GetMapping("/one")
	public ResultInfo getOneBrand(Integer brandId) {
		return iBrandService.selectBrandbyId(brandId);
	}
	/**
	 * 假删除1条品牌信息
	 * @param brandId 品牌ID
	 * @return Boolean值
	 */
	@PutMapping("/del")
	public ResultInfo deleteOneBrand(Integer brandId) {
		return iBrandService.deleteBrand(brandId);
	}
	/**
	 * 修改品牌信息
	 * @param brand 品牌对象
	 * @return Boolean值
	 */
	@PutMapping("/editor")
	public  ResultInfo updateOneBrand(Brand brand) {
		return iBrandService.updateBrand(brand);
	}
	/**
	 * 增加1条品牌信息
	 * @param brand 品牌对象
	 * @return Boolean值
	 */
	@PostMapping("/brandAdd")
	public ResultInfo addBrand(Brand brand) {
		return iBrandService.addBrand(brand);
	}
}
